﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using IQKS.AWP.BusinessObject;

namespace IQKS.AWP.DataAccessLayer
{
    public class AssessorInvoiceDAL
    {
        public DataSet GetAssessorInvoice(params object[] param)
        {
            DataSet objDs;

            try
            {
                objDs = DataUtils.ExecuteDataset("Usp_GetAssessorInvoice", param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }


        public DataSet GetInvoiceByAssessorID(params object[] param)
        {
            DataSet objDs;

            try
            {
                objDs = DataUtils.ExecuteDataset("Usp_GetInvoiceByAssessorID", param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }


        public object SetAssessorInvoice(AssessorInvoiceBO param)
        {
            try
            {
               
                SqlParameter[] parameters = new SqlParameter[]
			{
                new SqlParameter("@SetMethod",param.SetMethod),
                new SqlParameter("@InvoiceID",param.InvoiceID),
                new SqlParameter("@InvoiceNo",param.InvoiceNo),
                new SqlParameter("@InvoiceDate",param.InvoiceDate),
                new SqlParameter("@InvoiceAmount",param.InvoiceAmount),
                new SqlParameter("@InvoicePath",param.InvoicePath),
                new SqlParameter("@InvoiceComment",param.InvoiceComment),
                new SqlParameter("@CreatedBy",param.CreatedBy),
                
                new SqlParameter("@CandidateIDList",param.CandidatIDList),
                new SqlParameter("@BreifID",param.BreifID),
                new SqlParameter("@AssessorUserID",param.AssessorUserID)
               
               
              
			};
                return DataUtils.ExecuteScalar("Usp_SetAssessorInvoice", parameters);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
        public DataSet GetInvoiceDetailByInvoiceID(params object[] param)
        {
            DataSet objDs;

            try
            {
                objDs = DataUtils.ExecuteDataset("Usp_GetInvoiceDetailByInvoiceID", param);
            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }

        public DataSet GetCandidateByAssessor(params object[] param)
        {
            DataSet objDs;

            try
            {
                objDs = DataUtils.ExecuteDataset("USP_GetCandidateByAssessor", param);
            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }
        public object SetUploadAssessorInvoice(AssessorInvoiceBO param)
        {
            try
            {

                SqlParameter[] parameters = new SqlParameter[]
			{
                new SqlParameter("@SetMethod",param.SetMethod),
                new SqlParameter("@InvoiceID",param.InvoiceID),
                new SqlParameter("@InvoicePath",param.InvoicePath),
              
			};
                return DataUtils.ExecuteScalar("Usp_SetUploadAssessorInvoice", parameters);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
        
    }
}
